var app = getApp(),
appData = getApp().globalData;

Page({
  data: {
    mUrl: appData.Url + 'assets/icon/',
    bottonClr: ["white", "white", "white", "white", "white", "white"],
    setArr: [
      { id: "1", name: "赏金", img: "favorite", margin: "0" },
      { id: "2", name: "优惠券", img: "ticket", margin: "30" },
      { id: "3", name: "折抵记录", img: "time", margin: "0" },
      { id: "4", name: "赏金抵现", img: "order", margin: "30" },
      { id: "5", name: "帮助", img: "help", margin: "0" },
    ],
  },
  admin: e=> {
    if (appData.admin == null) return 0;
    wx.navigateTo({
      url: '../../admin/admin/admin',
    })
  },
  tap: e => {
    var btnID = e.currentTarget.id
    switch (btnID) {
      case "0": wx.navigateTo({ url: '../info/info', }); break;
      case "1": wx.navigateTo({ url: '../money/money/money', }); break;
      case "2": wx.navigateTo({ url: '../ticket/ticket', }); break;
      case "3": wx.navigateTo({ url: '../record/record', }); break;
      case "4":
        if (appData.share.total == 0) app.toast('赏金太少，无法抵现');
        else wx.navigateTo({ url: '../exchange/exchange', }); 
      break;
      case "5": wx.navigateTo({ url: '../help/help', }); break;
    }
    
  },
  test: e=> {
    console.log(e)
  },
//******************************************
  CA: function (e) { this.setData({[`bottonClr[${e.currentTarget.id}]`]: "#ddd"})},
  CB: function (e) { this.setData({[`bottonClr[${e.currentTarget.id}]`]: "#fff"})},


  onLoad:function(op){
    this.setData({ userAvatarUrl: appData.user.avatar})
  },


  onShareAppMessage: function() {

  }
})